import Vue from "vue"
import VueRouter from 'vue-router'
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};

Vue.use(VueRouter)

const routes = [
  {
    path: '/', // 我的卡券
    redirect:'/activity'
    },
  {
    path: '/activity/:activityCode', // 我的卡券
    component: () => import('@/components/teamActivity/team'),
    meta: {
      title: "团队活动",
    }
  
  },
  {
    path: '*', // 404
    component: () => import('@/components/teamActivity/404'),
    meta: {
      title: "404",
    }
  }
];
const router = new VueRouter({
  routes,
  scrollBehavior(to, from, savedPosition) {
    return {
      x: 0,
      y: 0
    }
  }
});
// router.beforeEach((to, from, next) => {
//   document.title = to.meta.title;
//   next();
// })
export default router